package cn.heyige.backend.exception;

import lombok.Getter;

/**
 * 错误码枚举
 */
@Getter
public enum ErrorCode {
    
    // 通用错误码 (1000-1999)
    SUCCESS(0, "操作成功"),
    SYSTEM_ERROR(1000, "系统内部错误"),
    PARAM_ERROR(1001, "参数错误"),
    UNAUTHORIZED(1002, "未授权访问"),
    FORBIDDEN(1003, "禁止访问"),
    NOT_FOUND(1004, "资源不存在"),
    METHOD_NOT_ALLOWED(1005, "请求方法不允许"),
    MEDIA_TYPE_NOT_SUPPORTED(1006, "不支持的媒体类型"),
    REQUEST_TIMEOUT(1007, "请求超时"),
    TOO_MANY_REQUESTS(1008, "请求过于频繁"),
    
    // 用户相关错误码 (2000-2999)
    USER_NOT_FOUND(2000, "用户不存在"),
    USER_ALREADY_EXISTS(2001, "用户已存在"),
    USER_PASSWORD_ERROR(2002, "密码错误"),
    USER_DISABLED(2003, "用户已被禁用"),
    USER_NOT_LOGIN(2004, "用户未登录"),
    USER_TOKEN_INVALID(2005, "用户令牌无效"),
    USER_TOKEN_EXPIRED(2006, "用户令牌已过期"),
    USER_QUOTA_INSUFFICIENT(2007, "用户配额不足"),
    USER_NOT_VIP(2008, "非VIP用户"),
    USER_VIP_EXPIRED(2009, "VIP已过期"),
    USER_PHONE_EXISTS(2010, "手机号已被注册"),
    USER_EMAIL_EXISTS(2011, "邮箱已被注册"),
    USER_NAME_ALREADY_EXISTS(2012, "用户名称已存在"),
    USER_QUOTA_NOT_EXISTS(2013, "用户配额信息不存在"),

    // 聊天相关错误码 (3000-3999)
    CHAT_SESSION_NOT_FOUND(3000, "聊天会话不存在"),
    CHAT_SESSION_CLOSED(3001, "聊天会话已关闭"),
    CHAT_SESSION_LIMIT_EXCEEDED(3002, "聊天会话数量超过限制"),
    CHAT_MESSAGE_EMPTY(3003, "聊天消息不能为空"),
    CHAT_MESSAGE_TOO_LONG(3004, "聊天消息过长"),
    CHAT_MODEL_NOT_AVAILABLE(3005, "AI模型不可用"),
    CHAT_MODEL_CALL_FAILED(3006, "AI模型调用失败"),
    CHAT_MODEL_TIMEOUT(3007, "AI模型调用超时"),
    CHAT_SENSITIVE_WORD(3008, "消息包含敏感词"),
    CHAT_SHARE_FAILED(3009, "分享失败"),
    
    // 支付相关错误码 (4000-4999)
    PAYMENT_FAILED(4000, "支付失败"),
    PAYMENT_CANCELLED(4001, "支付已取消"),
    PAYMENT_TIMEOUT(4002, "支付超时"),
    ORDER_NOT_FOUND(4003, "订单不存在"),
    ORDER_ALREADY_PAID(4004, "订单已支付"),
    ORDER_CANCELLED(4005, "订单已取消"),
    ORDER_EXPIRED(4006, "订单已过期"),
    
    // 敏感词相关错误码 (5000-5999)
    SENSITIVE_WORD_CONFIG_NOT_FOUND(5000, "敏感词配置不存在"),
    SENSITIVE_WORD_ALREADY_EXISTS(5001, "敏感词已存在"),
    SENSITIVE_WORD_CHECK_FAILED(5002, "敏感词检查失败"),
    
    // 会员相关错误码 (6000-6999)
    MEMBER_NOT_FOUND(6000, "会员信息不存在"),
    MEMBER_ALREADY_EXISTS(6001, "会员已存在"),
    MEMBER_LEVEL_NOT_FOUND(6002, "会员等级不存在"),
    MEMBER_BENEFIT_NOT_FOUND(6003, "会员权益不存在"),
    
    // 文件上传相关错误码 (7000-7999)
    FILE_UPLOAD_FAILED(7000, "文件上传失败"),
    FILE_SIZE_EXCEEDED(7001, "文件大小超过限制"),
    FILE_TYPE_NOT_SUPPORTED(7002, "不支持的文件类型"),
    FILE_NOT_FOUND(7003, "文件不存在"),
    
    // AI模型相关错误码 (8000-8999)
    AI_MODEL_NOT_CONFIGURED(8000, "AI模型未配置"),
    AI_MODEL_API_KEY_INVALID(8001, "AI模型API密钥无效"),
    AI_MODEL_RATE_LIMIT_EXCEEDED(8002, "AI模型调用频率超过限制"),
    AI_MODEL_QUOTA_EXCEEDED(8003, "AI模型配额用尽"),
    AI_MODEL_SERVICE_UNAVAILABLE(8004, "AI模型服务不可用"),
    AI_MODEL_RESPONSE_ERROR(8005, "AI模型响应错误"),
    AI_MODEL_CONTENT_FILTERED(8006, "AI模型内容被过滤"),

    // 微信相关错误码
    WX_ALREADY_BIND(9000, "微信已被其他账号绑定"),
    WX_MP_ALREADY_BIND(9001, "小程序已被其他账号绑定");

    private final int code;
    private final String message;
    
    ErrorCode(int code, String message) {
        this.code = code;
        this.message = message;
    }
}